From: Guido Günther Date: Mon, 5 Jan 2026 16:15:40 +0000 (+0100) Subject: mixer-control: Simplify device lookup X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2^2^2^2^2~4 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=0f34314cad72df0ca8c4b6d494a7bb7cc2ad34ab;p=gnome-shell.git mixer-control: Simplify device lookup There were too branches, one for portless streams (called "network streams" here) and those with ports. The portless one checked the stream-id only while the other branch checked stream-id and port. Simplify this by checking the stream-id and only comparing ports when available. As other streams can be portless nowadays this also removes some confusion. Best reviewed with 'git show -w' Signed-off-by: Guido Günther Origin: https://gitlab.gnome.org/GNOME/libgnome-volume-control/-/merge_requests/31 Bug: https://gitlab.gnome.org/GNOME/libgnome-volume-control/-/issues/34 Bug-Debian: https://bugs.debian.org/1126514 Applied-upstream: gnome-shell 50, commit:798230599950607ec285daecd070f5bcb28580e4 Gbp-Pq: Topic libgvc Gbp-Pq: Name mixer-control-Simplify-device-lookup.patch --- diff --git a/subprojects/gvc/gvc-mixer-control.c b/subprojects/gvc/gvc-mixer-control.c index 251f78a24..a8c75a062 100644 --- a/subprojects/gvc/gvc-mixer-control.c +++ b/subprojects/gvc/gvc-mixer-control.c @@ -239,7 +239,6 @@ gvc_mixer_control_lookup_device_from_stream (GvcMixerControl *control, GvcMixerStream *stream) { GList *devices, *d; - gboolean is_network_stream; const GList *ports; GvcMixerUIDevice *ret; @@ -253,39 +252,38 @@ gvc_mixer_control_lookup_device_from_stream (GvcMixerControl *control, ret = NULL; ports = gvc_mixer_stream_get_ports (stream); - is_network_stream = (ports == NULL); for (d = devices; d != NULL; d = d->next) { GvcMixerUIDevice *device = d->data; guint stream_id = G_MAXUINT; + const GvcMixerStreamPort *port; g_object_get (G_OBJECT (device), "stream-id", &stream_id, NULL); - if (is_network_stream && - stream_id == gvc_mixer_stream_get_id (stream)) { - g_debug ("lookup-device-from-stream - %s - it is a network_stream ", + if (stream_id != gvc_mixer_stream_get_id (stream)) + continue; + + if (ports == NULL) { + g_debug ("lookup-device-from-stream - %s - is portless ", gvc_mixer_ui_device_get_description (device)); ret = device; break; - } else if (!is_network_stream) { - const GvcMixerStreamPort *port; - port = gvc_mixer_stream_get_port (stream); - - if (stream_id == gvc_mixer_stream_get_id (stream) && - g_strcmp0 (gvc_mixer_ui_device_get_port (device), - port->port) == 0) { - g_debug ("lookup-device-from-stream found device: device description '%s', device port = '%s', device stream id %i AND stream port = '%s' stream id '%u' and stream description '%s'", - gvc_mixer_ui_device_get_description (device), - gvc_mixer_ui_device_get_port (device), - stream_id, - port->port, - gvc_mixer_stream_get_id (stream), - gvc_mixer_stream_get_description (stream)); - ret = device; - break; - } + } + + port = gvc_mixer_stream_get_port (stream); + if (g_strcmp0 (gvc_mixer_ui_device_get_port (device), port->port) == 0) { + g_debug ("lookup-device-from-stream found device: device description '%s', device port = '%s', device stream id %i AND stream port = '%s' stream id '%u' and stream description '%s'", + gvc_mixer_ui_device_get_description (device), + gvc_mixer_ui_device_get_port (device), + stream_id, + port->port, + gvc_mixer_stream_get_id (stream), + gvc_mixer_stream_get_description (stream)); + ret = device; + break; + } }